package lesson19;

public class Page {
	private final String title;
	private String text="";
	
	
	Page(String title){
		if(title != null)
			this.title = title;
		else{
			System.out.println("Wrong title format!");
			this.title = "";
		}
	}

	public String getText() {
		return title + "\n" + text;
	}

	public void addText(final String text) {
		if(text != null)
			this.text = this.text + text;
		else{
			System.out.println("wrong text format!");
			this.text = text;
		}
	}
	public void deleteText(){
		this.text = "";
	}
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Page){
			return ((Page) obj).title.equals(this.title);
		}
		else
			return false;
	}
}
